﻿using System;
using System.Net.Sockets;

namespace HslCommunication.Core.Net
{
	/// <summary>
	/// 网络中的异步对象
	/// </summary>
	// Token: 0x02000148 RID: 328
	internal class StateObject : StateOneBase
	{
		/// <summary>
		/// 实例化一个对象
		/// </summary>
		// Token: 0x06001C99 RID: 7321 RVA: 0x0008CB00 File Offset: 0x0008AD00
		public StateObject()
		{
		}

		/// <summary>
		/// 实例化一个对象，指定接收或是发送的数据长度
		/// </summary>
		/// <param name="length">数据长度</param>
		// Token: 0x06001C9A RID: 7322 RVA: 0x0008CB0A File Offset: 0x0008AD0A
		public StateObject(int length)
		{
			base.DataLength = length;
			base.Buffer = new byte[length];
		}

		/// <summary>
		/// 唯一的一串信息
		/// </summary>
		// Token: 0x170005A1 RID: 1441
		// (get) Token: 0x06001C9B RID: 7323 RVA: 0x0008CB29 File Offset: 0x0008AD29
		// (set) Token: 0x06001C9C RID: 7324 RVA: 0x0008CB31 File Offset: 0x0008AD31
		public string UniqueId { get; set; }

		/// <summary>
		/// 网络套接字
		/// </summary>
		// Token: 0x170005A2 RID: 1442
		// (get) Token: 0x06001C9D RID: 7325 RVA: 0x0008CB3A File Offset: 0x0008AD3A
		// (set) Token: 0x06001C9E RID: 7326 RVA: 0x0008CB42 File Offset: 0x0008AD42
		public Socket WorkSocket { get; set; }

		/// <summary>
		/// 是否关闭了通道
		/// </summary>
		// Token: 0x170005A3 RID: 1443
		// (get) Token: 0x06001C9F RID: 7327 RVA: 0x0008CB4B File Offset: 0x0008AD4B
		// (set) Token: 0x06001CA0 RID: 7328 RVA: 0x0008CB53 File Offset: 0x0008AD53
		public bool IsClose { get; set; }

		/// <summary>
		/// 清空旧的数据
		/// </summary>
		// Token: 0x06001CA1 RID: 7329 RVA: 0x0008CB5C File Offset: 0x0008AD5C
		public void Clear()
		{
			base.IsError = false;
			this.IsClose = false;
			base.AlreadyDealLength = 0;
			base.Buffer = null;
		}
	}
}
